package com.qms.qep.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.qms.qep.mapper.DefectRecordMapper;
import com.qms.qep.domain.DefectRecord;
import com.qms.qep.service.IDefectRecordService;

/**
 * 缺陷记录Service业务层处理
 * 
 * @author DefectRecord
 */
@Service
public class DefectRecordServiceImpl implements IDefectRecordService 
{
    @Autowired
    private DefectRecordMapper defectRecordMapper;

    /**
     * 查询缺陷记录
     * 
     * @param id 缺陷记录主键
     * @return 缺陷记录
     */
    @Override
    public DefectRecord selectDefectRecordById(Integer id)
    {
        return defectRecordMapper.selectDefectRecordById(id);
    }

    /**
     * 查询缺陷记录列表
     * 
     * @param defectRecord 缺陷记录
     * @return 缺陷记录
     */
    @Override
    public List<DefectRecord> selectDefectRecordList(DefectRecord defectRecord)
    {
        return defectRecordMapper.selectDefectRecordList(defectRecord);
    }

    /**
     * 新增缺陷记录
     * 
     * @param defectRecord 缺陷记录
     * @return 结果
     */
    @Override
    public int insertDefectRecord(DefectRecord defectRecord)
    {
        return defectRecordMapper.insertDefectRecord(defectRecord);
    }

    /**
     * 修改缺陷记录
     * 
     * @param defectRecord 缺陷记录
     * @return 结果
     */
    @Override
    public int updateDefectRecord(DefectRecord defectRecord)
    {
        return defectRecordMapper.updateDefectRecord(defectRecord);
    }

    /**
     * 批量删除缺陷记录
     * 
     * @param ids 需要删除的缺陷记录主键
     * @return 结果
     */
    @Override
    public int deleteDefectRecordByIds(Integer[] ids)
    {
        return defectRecordMapper.deleteDefectRecordByIds(ids);
    }

    /**
     * 删除缺陷记录信息
     * 
     * @param id 缺陷记录主键
     * @return 结果
     */
    @Override
    public int deleteDefectRecordById(Integer id)
    {
        return defectRecordMapper.deleteDefectRecordById(id);
    }
    
    /**
     * 根据检验任务ID查询缺陷记录
     *
     * @param inspectionTaskId 检验任务ID
     * @return 缺陷记录列表
     */
    @Override
    public List<DefectRecord> selectDefectRecordByTaskId(Integer inspectionTaskId)
    {
        return defectRecordMapper.selectDefectRecordByTaskId(inspectionTaskId);
    }
    
    /**
     * 统计缺陷记录数量
     *
     * @param defectRecord 缺陷记录
     * @return 统计结果
     */
    @Override
    public int countDefectRecord(DefectRecord defectRecord)
    {
        return defectRecordMapper.countDefectRecord(defectRecord);
    }
} 